BigDFT.UnitCells module
A module for handling unit cells for periodic calculations.
- class UnitCell(cell=None, units='bohr')[source]
Defines a wrapper for unit cells.
- Parameters:
- get_boundary_condition(units='bohr')[source]
Get a string description of the boundary condition (i.e. free, surface, wire, periodic)
- get_posinp(units='bohr')[source]
Create the dictionary representation of the cell that is passed to BigDFT.
- Returns:
a list of the three values of the unit cell.
- Return type:
(list)
- minimum_image(pos, units='bohr')[source]
Given a vector of three positions, this wraps those positions inside the cell using the minimum image convention.
- Returns:
a list of the values of the wrapped position.
- Return type:
(list)
- to_cartesian(pos)[source]
Convert a vector which is in reduced units to cartesian units.
- Returns:
the position in cartesian coordinates.
- Return type:
(list)
- to_reduced(pos)[source]
Convert a vector which is in cartesian units to reduced units.
- Returns:
the position in reduced coordinates.
- Return type:
(list)
- get_length_angle(units='bohr')[source]
Returns a description of the unit cell in terms of side lengths and angles.
- Returns:
list of 3 sides. (list): list of 3 angles.
- Return type:
(list)
- _example()[source]
The following is an example of module usage:
# Create a basic unit cell cell = UnitCell([10, 8, 4], units="angstroem") # Print out the posinp representation print(cell.get_posinp()) print(cell.get_posinp(units="angstroem")) # Right now we enforce the orthorhombic condition try: cell = UnitCell([[10, 0, 0], [0, 8, 0], [0, 4, 10]]) except ValueError as e: print(e) cell = UnitCell([[10, 0, 0], [0, 8, 0], [0, 0, 4]]) print(cell.get_boundary_condition("angstroem")) # Wire boundary condition wire = UnitCell([float("inf"), float("inf"), 4]) print(wire.get_posinp()) print(wire.get_boundary_condition()) # Surface boundary condition surface = UnitCell([10, float("inf"), 4]) print(surface.get_posinp()) print(surface.get_boundary_condition()) # Wrap positions to the minimum image convention. pos = [-5, -2, -3] print(cell.minimum_image(pos)) print(wire.minimum_image(pos)) print(surface.minimum_image(pos)) pos = [15, 12, 13] print(cell.minimum_image(pos)) print(wire.minimum_image(pos)) print(surface.minimum_image(pos))